﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace TheCup
{
    public enum CommentEntity
    {
        Blog,
        Event,
        Round
    }

    [Table("Comment")]
    public class CommentNew
    {
        public int Id { get; set; }
        public Nullable<int> ForeignId { get; set; }
        public Nullable<CommentEntity> EntityType { get; set; }

        public string Initials { get; set; }
        public string GivenName { get; set; }
        public string LastName { get; set; }
        
        [Display(Name="Titel")]
        public string Name { get; set; }

        [Display(Name = "Kommentar")]
        public string Value { get; set; }

        [Display(Name = "dato")]
        public DateTime TimeStamp { get; set; }

        [NotMapped]
        public string DisplayName
        {
            get
            {
                return string.Join(" ", GivenName, LastName);
            }
        }
    }

    [Table("Commentary")]
    public class Comment
    {
        [Key]
        [Column("no")]
        public int Id { get; set; }

        [Column("Id")]
        [Obsolete]
        public Guid uuid { get; set; }

        [Column("LinkId")]
        [Obsolete]
        public Guid LinkUuid { get; set; }

        [Column("LinkNo")]
        public Nullable<int> LinkId { get; set; }

        [Obsolete]
        public string Category { get; set; }

        public Nullable<CommentEntity> Type { get; set; }

        [Column("UserId")]
        [Obsolete]
        public Guid OldUserGuId { get; set; }

        [Column("Time")]
        public DateTime DateEntry { get; set; }

        [Column("userno")]
        public int PlayerId { get; set; }

        [ForeignKey("PlayerId")]
        public virtual Player Player { get; set; }

        [Column("Comment")]
        public string Text { get; set; }
    }
}